Do Elites Know Best? Candidate Selection and Policy Implementation in Post-independence Tanzania
Jeremy Bowles

Replication Readme


Software used: Stata/MP 18.0, R 4.4.0, RStudio 2023.9

Required packages (Stata): esttab, estout, reghdfe, ivreghdfe, boottest, ranktest, tools, require
	- Note: Replication file uses ivreghdfe 1.1.4 installed from Github (https://github.com/sergiocorreia/ivreghdfe)
Required packages (R): data.table, tidyverse, haven, foreign, sf, fixest, car, systemfit, modelsummary, kableExtra, viridis, wesanderson, egg, vdemdata, pacman, remotes
	- Note: Install vdemdata using "remotes::install_github("vdeminstitute/vdemdata")"

To replicate all figures and plots in the paper, run files in this order:

(1) main.R			: R file which will produce tables and figures, outputting each to the "Tables" and "Figures" subfolders. Script requires running in RStudio for the directory environment variables (line 5). 
(2) main.do			: Stata file which will produce tables and figures, outputting each to the "Tables" and "Figures" subfolders. Note that the global root folder in the do file will need to be set to your relevant directory (line 5).
(3) all_tables_and_figures.tex	: Shell LaTeX file which will populate with the outputs of (1) and (2). 
				  All tables and figures are named according to their respective positions in the paper.
  				  The "Tables" and "Figures" subfolders are populated with the output of the replication package to enable this file to render without running the replication scripts.

The R file primarily outputs descriptive analyses while the Stata file outputs the main analyses contained in the paper (i.e. analyses relating to treatment effects). The location for code to generate each Figure and Table is clearly marked within the respective files. Runtime for the R file should be short, while the bootstrap procedure for the instrumental variables analysis is more computationally intensive (particularly relating to Tables 6, A21, A22). 


Other files in root folder:

codebook.pdf			: Codebook for analysis datasets.
main_and_appendix.tex		: All tables and figures in main paper/online appendix produced using replication data.
main_and_appendix.pdf		: All tables and figures in main paper/online appendix produced using replication data (output). This file will be overwritten when  main_and_appendix.tex is rendered.


The "Tables" and "Figures" folders contain the relevant outputs of main.R and main.do, which will be overwritten when these scripts are run. 


Files in "Data" subfolder (see codebook.pdf for information on particular variables in each file):

descriptive.dta			: Descriptive data on assignment and election outcomes.
analysis_1.dta			: Analysis data used for candidate characteristics and design validation. 
analysis_2.dta			: Analysis data used for constituency-level treatment effects. 
analysis_3.dta			: Analysis data used for district-level treatment effects.
analysis_4.dta			: Analysis data used for HRDS-based treatment effects.
question_mapping.csv		: Correspondence file used to populate figure labels in main.R.
shapefile.shp			: Shapefile of constituency boundaries in 1965/1970 elections.
lpg.csv				: Data on local public goods by year.
schools_validation.csv		: Validation data on schools allocation.
five_year_plans.csv		: Five-year plan data on capital allocation.
iv_jackknife.csv		: Bootstrapped estimates for use in generating Figure A12. These are generated in the bottom section of main.do.